<template>
	<uni-nav-bar :title="fillingInfo.name" left-icon="left" @clickLeft="navBack" :fixed="true" statusBar></uni-nav-bar>
	<view class="package_sale">
		<view style="font-size: 36rpx;">{{fillingInfo.name}}</view>
		<view style="margin: 10rpx 0px;">补液单价：{{fillingInfo.price}}元/公斤</view>
		<view>{{fillingInfo.address}}</view>
	</view>
	<view class="package_sale space-between">
		<view style="width:50%">
			<view>账户余额</view>
			<view><text>￥</text><text style="font-size: 60rpx;">{{fillingInfo.money}}</text></view>
		</view>
		<view style="width:50%">
			<view>溶液总量</view>
			<view><text style="font-size: 60rpx;">{{fillingInfo.amount}}</text></view>
		</view>
	</view>
	<view class="package_sale space-between ability" style="background: transparent;padding: 0px;">
		<view v-for="item in list" :key="item" @click="jump(item.name,item.push)">{{item.name}}</view>
	</view>
</template>

<script setup lang="ts">
	import { onShow } from '@dcloudio/uni-app';
	import { navBack, navTo } from '@/utils/navigator';
	import { fillingStation } from '@/stores/rehydrator';
	// import { scanQRCode } from '@/utils/wechat.jssdk';
	const fillingInfo = fillingStation();
	onShow(() => {
		fillingInfo.getDeliveryIn()
	})
	// rehydrator/filling/fluid
	const list = [{ name: '配送车补液', push: 'Sale/inventory/addInventory?type=1' },
	{ name: '槽罐车盘库', push: 'Sale/inventory/addInventory?state=1' },
	{ name: '账户明细', push: 'rehydrator/account/accountDetails' },
	{ name: '补液记录', push: 'rehydrator/filling/fluidList' },
	{ name: '售液记录', push: 'rehydrator/filling/sellFill' },
	{ name: '加注机', push: 'rehydrator/filling/fillList' }]
	/**
	 * 跳转补液信息页面
	 * @param {String} name 选择跳转的名称
	 * @param {String} push 选择跳转的路径
	 */
	function jump(name : string, push : string) {
		navTo(push)
		// if (name == '补液') {
		//   scanQRCode((res : any) => {
		//     const orderIDs = res.resultStr.split('fill_id=')[1];
		//     if (orderIDs) {
		//       uni.setStorageSync('fillingID', orderIDs);
		//       navTo(push)
		//     } else {
		//       alert('请扫描正确的二维码进行加注');
		//     }
		//   });
		// } else {
		//   navTo(push)
		// }
	}
</script>

<style scoped lang="less">
	.ability {
		flex-wrap: wrap;

		view {
			width: 48.5%;
			height: 102rpx;
			background: #FFFFFF;
			border: 1px solid #EEF3F7;
			border-radius: 6px;
			text-align: center;
			line-height: 102rpx;
			margin-bottom: 15rpx;
		}
	}
</style>